package com.hjs.paclouddao.controller;

import com.hjs.paclouddao.pojo.File;
import com.hjs.paclouddao.service.IFileService;
import com.hjs.paclouddao.service.impl.FileServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @auther hanjinsong
 * @create 2019-08-19 11:24
 */
@RestController
@Slf4j
public class FileController {

    @Autowired
    private IFileService iFileService;

    @GetMapping("/selectById")
    public File selectById(@RequestParam("id") Integer id){
        File file = iFileService.select(id);
        return file;
    }

    @GetMapping("/insert")
    public int insert(@RequestParam("file") File file){
        int i = iFileService.insert(file);
        return i;
    }
    @GetMapping("/selectAllName")
    public List<String> selectAllName(){
        log.info("查询所有的文件名称");
        List<String> fileList = iFileService.selectAllName();
        return fileList;
    }

}
